<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <script type="text/javascript">
      var macAddress = '';
      var computerName = '';
      var wmi = GetObject('winmgmts:{impersonationLevel=impersonate}');
      e = new Enumerator(
        wmi.ExecQuery('SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = True'),
      );
      for (; !e.atEnd(); e.moveNext()) {
        var s = e.item();
        macAddress = s.MACAddress;
        computerName = s.DNSHostName;
      }
    </script>
  </head>
  <body>
    <input type="text" id="txtMACAdress" />
    <input type="text" id="txtComputerName" />
    <script type="text/javascript">
      document.getElementById('txtMACAdress').value = unescape(macAddress);
      document.getElementById('txtComputerName').value = unescape(computerName);
    </script>
  </body>
</html>
